%Fs = 1024;                      % Sampling frequency
%t  = 0:1/Fs:1-(1/Fs);           % Time vector
A  = 1;                         % Peak amplitude
%F1 = 128;                       % Hz
%x  = A*sin(2*pi*t*F1);          % Sinusoidal signal
x = u;

hp = spectrum.periodogram('hamming');  % Create periodogram

% Create options object and set properties
hpopts = psdopts(hp,x);
set(hpopts,'Fs',fpr,'SpectrumType','twosided','centerdc',true);

msspectrum(hp,x,hpopts);
%v = axis; axis([v(1) v(2) -10 -5.5]);   % Zoom in Y.
pause
hpsd = psd(hp,x,hpopts);
plot(hpsd);

power_freqdomain = avgpower(hpsd)
power_timedomain = sum(abs(x).^2)/length(x)